If $a_0 = \sin^2 \left( \frac{\pi}{45} \right)$ and
\[a_{n + 1} = 4a_n (1 - a_n)\]for $n \ge 0,$ find the smallest positive integer $n$ such that $a_n = a_0.$
Answer: Suppose $a_n = \sin^2 x.$  Then
\begin{align*}
a_{n + 1} &= 4a_n (1 - a_n) \\
&= 4 \sin^2 x (1 - \sin^2 x) \\
&= 4 \sin^2 x \cos^2 x \\
&= (2 \sin x \cos x)^2 \\
&= \sin^2 2x.
\end{align*}It follows that
\[a_n = \sin^2 \left( \frac{2^n \pi}{45} \right)\]for all $n \ge 0.$

We want to find the smallest $n$ so that $a_n = a_0.$  In other words
\[\sin^2 \left( \frac{2^n \pi}{45} \right) = \sin^2 \left( \frac{\pi}{45} \right).\]This means the angles $\frac{2^n \pi}{45}$ and $\frac{\pi}{45}$ either add up to a multiple of $\pi,$ or differ by a multiple of $\pi.$  In other words,
\[2^n \equiv \pm 1 \pmod{45}.\]We list the first few powers of 2 mod 45.

\[
\begin{array}{c|c}
n & 2^n \pmod{45} \\ \hline
0 & 1 \\
1 & 2 \\
2 & 4 \\
3 & 8 \\
4 & 16 \\
5 & 32 \\
6 & 19 \\
7 & 38 \\
8 & 31 \\
9 & 17 \\
10 & 34 \\
11 & 23 \\
12 & 1
\end{array}
\]Thus, the smallest such $n$ is $\boxed{12}.$